---
title: Baidu Qianfan
---

The `BaiduQianfanEmbeddings` class uses the Baidu Qianfan API to generate embeddings for a given text.

## Setup

An API key is required to use this embedding model. You can get one by registering at https://cloud.baidu.com/doc/WENXINWORKSHOP/s/alj562vvu.

Please set the acquired API key as an environment variable named BAIDU_API_KEY, and set your secret key as an environment variable named BAIDU_SECRET_KEY.

Then, you'll need to install the [`@langchain/baidu-qianfan`](https://www.npmjs.com/package/@langchain/baidu-qianfan) package:

import IntegrationInstallTooltip from '/snippets/javascript-integrations/integration-install-tooltip.mdx';

<IntegrationInstallTooltip/>

```bash npm
npm install @langchain/baidu-qianfan @langchain/core
```

## Usage

import BaiduQianfan from "/snippets/javascript-integrations/examples/embeddings/baidu_qianfan.mdx";

<BaiduQianfan />

## Related

- Embedding model [conceptual guide](/oss/concepts/embedding_models)
- Embedding model [how-to guides](/oss/how-to/#embedding-models)
